package com.tmt.im.manager.mapstruct;

import com.tmt.im.jpa.entity.IMFriendApply;
import com.tmt.im.manager.controller.vo.FriendApplyInfoVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/26 20:58
 * @Version 1.0
 **/
@Component
@Mapper(componentModel = "spring")
public interface IMFriendApplyMapStruct1 {

    @Mappings({
            @Mapping(target = "id", source = "apply.id"),
            @Mapping(target = "friendId", source = "apply.creator.id"),
            @Mapping(target = "memberCode", source = "apply.creator.memberCode"),
            @Mapping(target = "friendNickname", source = "apply.creator.nickname"),
            @Mapping(target = "friendAvatar", source = "apply.creator.avatar"),
            @Mapping(target = "note", source = "apply.note"),
            @Mapping(target = "grade", expression = "java(com.tmt.im.manager.helper.IMFriendApplyHelper.getGrade1(apply))"),
            @Mapping(target = "reviewStatus", expression = "java(com.tmt.im.manager.helper.IMFriendApplyHelper.getReviewStatus(apply))"),
            @Mapping(target = "mode", source = "apply.mode"),
            @Mapping(target = "modeDescr", expression = "java(com.tmt.im.manager.helper.IMFriendApplyHelper.getModeDescr(apply))"),
            @Mapping(target = "createTime", expression = "java(com.tmt.im.manager.helper.IMFriendApplyHelper.getCreateTime(apply))")
    })
    FriendApplyInfoVo toFriendApplyInfoVo(IMFriendApply apply);

    List<FriendApplyInfoVo> toFriendApplyInfoVos(List<IMFriendApply> applies);

}
